package com.baseframe.secure.config;


import com.baseframe.secure.aspect.AuthorizeTokenAspect;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.DispatcherServlet;

import javax.servlet.Servlet;


@Configuration(proxyBeanMethods = false)
public class BaseSecureConfiguration {

    @Bean
    @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
    @ConditionalOnClass({Servlet.class, DispatcherServlet.class})
    public AuthorizeTokenAspect authorizeTokenAspect(){

        return new AuthorizeTokenAspect();
    }
}
